import { defineStore } from "pinia";

export const useExportGroupSelectStore = defineStore("exportGroupSelect", {
    state: () => {
        return {
            selections:[1, 2],
            selected:[1]
        };
    },
    actions: {
        setSelections(arr:number[]) {
            this.selections.splice(0, this.selections.length);
            for (let i = 0; i < arr.length; i++) {
                this.selections.push(arr[i]);
            }
        },
        set(arr:number[]) {
            this.selected.splice(0, this.selected.length);
            for (let i = 0; i < arr.length; i++) {
                this.selected.push(arr[i]);
            }
        },
        addGroup(id:number) {
            if (this.selected.indexOf(id) == -1)
                this.selected.push(id);
        },
        removeGroup(id:number) {
            this.selected.splice(this.selected.indexOf(id), 1);
        },
    },
});